package com.ww.springboot.boot.javabase.list;

import org.apache.commons.collections4.Bag;

import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.LongStream;

/**
 * 数组排序
 *
 * @author wanwei
 * @since 2021-03-16 23:12
 */
public class ListDemo1 {

    public static void main(String[] args) {

        //1.快速生成数组
        List<Integer> list = IntStream.range(1, 1000000).boxed().collect(Collectors.toList());

        list.sort((o1, o2) -> o2 - o1);
        System.out.println(list.get(100));
        list.sort(Comparator.comparingInt(o -> o));
        System.out.println(list.get(100));



        String[] arrayList = {};

        List<String> list2 = Arrays.stream(arrayList).collect(Collectors.toList());

        arrayList = list2.stream().toArray(String[]::new);
    }
}
